<template>
  <div class="mobile-bill-view common-mobile-view">
    <bill-query />

    <el-date-picker v-if="billStore.billDateType === 'month'"
                    v-model="billStore.billQueryForm.billMonth"
                    type="month" :editable="false" style="width: 120px;"
                    @change="billStore.refreshInfo()"/>

    <el-date-picker v-if="billStore.billDateType === 'year'"
                    v-model="billStore.billQueryForm.billYear"
                    type="year" :editable="false" style="width: 120px;"
                    @change="billStore.refreshInfo()"/>

    <bill-stats />
    <bill-chart />
  </div>
</template>

<script lang="ts" setup>
import BillQuery from '@/components/Bill/BillQuery.vue'
import BillStats from '@/components/Bill/BillStats.vue'
import BillChart from '@/components/Bill/BillChart.vue'
import { onMounted } from 'vue'
import { useBillStore } from '@/store/bill.ts'

const billStore = useBillStore()

onMounted(async () => {
  await billStore.refreshInfo()
})
</script>

<style lang="scss">
@use "@/styles/home/bill.mobile.module";
</style>
